package com.android.lovely.data

import android.graphics.Color
import androidx.core.graphics.toColorInt
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
open class DialogueStyle(
    @Json(name = "fontSize") open var fontSize: Int,
    @Json(name = "dialogueItalic") open var dialogueItalic: Boolean,
    @Json(name = "descItalic") open var descItalic: Boolean,
    @Json(name = "dialogueColor") open var dialogueColor: Int,
    @Json(name = "descColor") open var descColor: Int,
    @Json(name = "otherItalic") open var otherItalic: Boolean,
    @Json(name = "otherColor") open var otherColor: Int,
    @Json(name = "backgroundColor") open var backgroundColor: Int,
    @Json(name = "backgroundColorAlpha") open var backgroundColorAlpha: Int
)

@JsonClass(generateAdapter = true)
data class RoleDialogueStyle(
    @Json(name = "fontSize") override var fontSize: Int = 15,
    @Json(name = "dialogueItalic") override var dialogueItalic: Boolean = false,
    @Json(name = "descItalic") override var descItalic: Boolean = true,
    @Json(name = "dialogueColor") override var dialogueColor: Int = "#D2D2D2".toColorInt(),
    @Json(name = "descColor") override var descColor: Int = "#7C7C7E".toColorInt(),
    @Json(name = "otherItalic") override var otherItalic: Boolean = false,
    @Json(name = "otherColor") override var otherColor: Int = "#A3A7D3".toColorInt(),
    @Json(name = "backgroundColor") override var backgroundColor: Int = "#121214".toColorInt(),
    @Json(name = "backgroundColorAlpha") override var backgroundColorAlpha: Int = 92
) : DialogueStyle(
    fontSize,
    dialogueItalic,
    descItalic,
    dialogueColor,
    descColor,
    otherItalic,
    otherColor,
    backgroundColor,
    backgroundColorAlpha
)

@JsonClass(generateAdapter = true)
data class UserDialogueStyle(
    @Json(name = "fontSize") override var fontSize: Int = 15,
    @Json(name = "dialogueItalic") override var dialogueItalic: Boolean = false,
    @Json(name = "descItalic") override var descItalic: Boolean = false,
    @Json(name = "dialogueColor") override var dialogueColor: Int = Color.WHITE,
    @Json(name = "descColor") override var descColor: Int = Color.WHITE,
    @Json(name = "otherItalic") override var otherItalic: Boolean = false,
    @Json(name = "otherColor") override var otherColor: Int = Color.WHITE,
    @Json(name = "backgroundColor") override var backgroundColor: Int = "#463ABA".toColorInt(),
    @Json(name = "backgroundColorAlpha") override var backgroundColorAlpha: Int = 92
) : DialogueStyle(
    fontSize,
    dialogueItalic,
    descItalic,
    dialogueColor,
    descColor,
    otherItalic,
    otherColor,
    backgroundColor,
    backgroundColorAlpha
)

@JsonClass(generateAdapter = true)
data class StoreDialogueStyle(
    @Json(name = "role") var role: RoleDialogueStyle = RoleDialogueStyle(),
    @Json(name = "user") var user: UserDialogueStyle = UserDialogueStyle(),
) {
    fun copy(): StoreDialogueStyle {
        return StoreDialogueStyle(role.copy(), user.copy())
    }
}

